11. Training a Model

Training a Model

Earlier, I gave a simple example of a classification model that classifies all images as either car or not-car. And I said that using machine learning techniques, you can give a model lots of examples of cars and not-cars until it learns to recognize them. But, how exactly does this work?

Similar to how humans learn, a model has to learn by its successes and mistakes, and we often call this the training phase. At the beginning of a training phase, a classification model typically performs very badly.

The model will look at an image, try to classify it as a car or not-car and monitor the errors that it makes. For example, if a model mistakenly classifies a car as not-car, it will learn from this mistake, tweak its classification parameters and improve its performance each time it sees more images.

After many iterations, the model converges on the right set of parameters and the error rate becomes low. That’s when we consider the model to be trained.

A training flow is pictured below. This is a convolutional neural network that learns to recognize and distinguish between images of cars and not-cars.

A convolutional neural network will adjust its pattern recognition algorithm until it learns to accurately classify a set of images.

A convolutional neural network will adjust its pattern recognition algorithm until it learns to accurately classify a set of images.

Now, this is a very high-level view of how to train any classification model. And the details will vary based on the type of model you use and the training algorithm you choose.